package com.windowes.weichang.controller.manage;

import com.windowes.weichang.common.ServerResponse;
import com.windowes.weichang.pojo.Community;
import com.windowes.weichang.service.CommunityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/***
 *
 * @author: yangqing
 * @email: qing.yang@bangdao-tech.com
 * @createTime: 2018/6/29 下午5:09
 * @description:
 *
 **/
@Api(description = "小区相关API")
@RestController
@RequestMapping("community")
public class CommunityController {

    @Autowired
    CommunityService communityService;

    @ApiOperation(value = "添加/更新小区信息", notes = "【平台】")
    @PostMapping("addOrUpdate")
    public ServerResponse addOrUpdate(@RequestBody Community community) {
        return communityService.addOrUpdate(community);
    }

    @ApiOperation(value = "获取店铺下所有小区", notes = "【平台】")
    @GetMapping("list")
    public ServerResponse list(Integer shopId) {
        return communityService.list(shopId);
    }

    @ApiOperation(value = "删除店铺下小区", notes = "【平台】")
    @GetMapping("delete")
    public ServerResponse delete(Integer id) {
        return  communityService.delete(id);
    }


    @ApiOperation(value = "获取店铺下所有小区", notes = "【平台】")
    @GetMapping("item")
    public ServerResponse item(Integer id) {
        return communityService.item(id);
    }


}
